#include <string>
#include <iostream>
#include "Team.h"
using namespace std;

string Team::getPlayerName(){

	return Team::playerName[5];
}

void Team::addPlayer(string newplayer){
	Team::playerName[Team::numOfPlayers]=newplayer;
	Team::numOfPlayers++;
	if (Team::numOfPlayers==5){
		Team::teamFull=true;
	}
	//return Team::addPlayer;
}
void Team::setTeamName(string newName){
	Team::teamName=newName;
}

int Team::getNumOfPlayers(){

	return Team::numOfPlayers;
}

string Team::getTeamName(){
	
	return Team::teamName;
}

bool Team::getTeamFull(){

	return Team::teamFull;
}
Team::Team(){

	Team::teamFull=false;
	Team::numOfPlayers=0; // initial condition
}
int main()

{

	// asks user for team names...
	Team team1;
	Team team2;
	cout << "type the name of the first team: ";
	string newnam;
	cin >> newnam;
	team1.setTeamName(newnam);
	cout << "type the name of the second team: ";
	string newnam2;
	cin >> newnam2;
	team2.setTeamName(newnam2);

	// asks for player list.....

	string playerName[10];
	cout << "enter players name: ";
	for(int i=0;i<10;i++){
		cin >> playerName[i];
	}

	// generates number....
	srand(time(NULL));
	int randnum;
	string boo;
	for (int b=0;b<10;b++){
		randnum=rand();
	if (randnum%2==1 && team1.getTeamFull()){
			team1.addPlayer(playerName[b]);
	}
		else if ( randnum==0 && team2.getTeamFull())
		{
			team2.addPlayer(playerName[b]);
	}
		else if ( randnum==1 && team2.getTeamFull())
		{
			team2.addPlayer(playerName[b]);

		}
		else if ( randnum==0 && team1.getTeamFull())
		{
			team1.addPlayer(playerName[b]);
		}

	}
	
system("PAUSE");
return 0;
}

	
